AER-4645 Fix to update load metric also on a regular basis - #135
Merged
Merged
Conversation
Current implementation only updated load when task dispatched or finished. With long running jobs this could mean it takes some time to update. But since load is used to scale it could be the load value triggered scaling, when scaled it would be expected the load to decrease (more workers for same work). But when load is not updated the load stays the same and system might still think it needs scaling up, and will scale up even more. With this change it will use the regular called update that was only used to track the initial state of the queue. It now uses a delta of 0 as there are no new number of messages. In the LoadMetric it will than only perform an update if the number of workers changed. In other situation there is no reason to update. LoadMetric changed a bit because process computes the values at the moment called but it does that by calling with last known values and delta 0. But with new guard it would result in update not being performed. Therefore put update in separate method. Removed dispatchedTasks from TaskManagerUsageMetricsProvider as it was to cover for tasks that were still on the queue when the taskmanager would be (re)started. But with startupGuard these messages are accounted for and therefore no need to filter those out is needed.
JornC
approved these changes
Sep 11, 2026
Hilbrand
force-pushed
the
AER-4645-load-fix
branch
from
September 11, 2026 10:12
318c782 to
e17e858
Compare
tom-h42
reviewed
Sep 14, 2026
tom-h42
left a comment
There was a problem hiding this comment.
Some spelling in the test comments, and a question about the sequencing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current implementation only updated load when task dispatched or finished. With long running jobs this could mean it takes some time to update. But since load is used to scale it could be the load value triggered scaling, when scaled it would be expected the load to decrease (more workers for same work). But when load is not updated the load stays the same and system might still think it needs scaling up, and will scale up even more. With this change it will use the regular called update that was only used to track the initial state of the queue. It now uses a delta of 0 as there are no new number of messages. In the LoadMetric it will than only perform an update if the number of workers changed. In other situation there is no reason to update.
LoadMetric changed a bit because process computes the values at the moment called but it does that by calling with last known values and delta 0. But with new guard it would result in update not being performed. Therefore put update in separate method.
Removed dispatchedTasks from TaskManagerUsageMetricsProvider as it was to cover for tasks that were still on the queue when the taskmanager would be (re)started. But with startupGuard these messages are accounted for and therefore no need to filter those out is needed.